
#include "BaseSocket.h"


BaseSocket::BaseSocket(Proactor* proactor,int type)
{
    pj_bzero(&cb, sizeof(cb));
    pj_bzero(&cfg, sizeof(cfg));
    pj_bzero(&addr, sizeof(addr));
    pj_bzero(&send_key, sizeof(send_key));

	sock = PJ_INVALID_SOCKET;

	p_asock = NULL;
	
	sock_type = type;
	p_proactor = proactor;
}


BaseSocket::~BaseSocket()
{
	pj_status_t status;
	if (!p_asock)
		return ;

	status = pj_activesock_close(p_asock);
	if (status != PJ_SUCCESS)
		PJ_LOG(1,("","BaseSocket::~BaseSocket() pj_activesock_close asock=%p",p_asock));
}

int BaseSocket::GetSockType()
{
	return sock_type;
}

int BaseSocket::GetSockHandle()
{
	return sock;
}